<?php

/**
 * Берет идентификатор авторизированного пользователя
 */
function get_access_userid() {
	include_once('moodle/class.moodle_access.php');
	$moodle_access = new moodle_access();
	$user_id = $moodle_access->get_user_id();
	return $user_id;
}
$user_id = get_access_userid();

include_once('config.php');
include_once($CFG->lib_dir . '/class.debug.php');
include_once($CFG->lib_dir . '/class.router.php');
include_once($CFG->app_dir . '/authentication/class.authentication.php');

$debug = new debug(true);

$authentication = new authentication($user_id);

$router = new router($CFG->app_dir . '/config/routes.php');

try {
	$router->run();
} catch (Exception $e) {
	echo '<pre>' . $e->getMessage() . "\n" . $e->getTraceAsString() . '</pre>';
}

?>
